package burp;

import java.io.PrintWriter;

/**
 * Created by td on 2017/6/30.
 */
public class ExtenderCallbacks {
    private IBurpExtenderCallbacks callbacks;
    private static  ExtenderCallbacks extenderCallbacks = null;
    private PrintWriter stdout;

    public static ExtenderCallbacks getInstance(){
        if (null == extenderCallbacks){
            extenderCallbacks = new ExtenderCallbacks();
        }
        return extenderCallbacks;
    }

    public ExtenderCallbacks() {

    }

    public void init(IBurpExtenderCallbacks callbacks){
        this.callbacks = callbacks;
        this.stdout = new PrintWriter(this.callbacks.getStdout());
        extenderCallbacks = this;

    }

    /*  public ExtenderCallbacks(IBurpExtenderCallbacks callbacks) {
            this.callbacks = callbacks;
            this.stdout = new PrintWriter(this.callbacks.getStdout(),true);
        }
    */
    public IBurpExtenderCallbacks getCallbacks() {
        return callbacks;
    }

    public void setCallbacks(IBurpExtenderCallbacks callbacks) {
        this.callbacks = callbacks;
    }

    public IExtensionHelpers getHelpers(){
        return this.callbacks.getHelpers();
    }

    public void print(String string){
        this.stdout.println(string);
    }
}
